#include "head_2.h"

extern int dev_uart_fd;
extern int msgid;

void * pthread_uart_cmd(){
	
	struct msg msgtxt;
	char dev_uart_mask;
//	int sockfd = (int)arg;
//	struct msg msgtxt;
	while(1){
		if (msgrcv(msgid,(void *)&msgtxt,sizeof(struct msg) - sizeof(long),2L,0) < 0)
		{
			perror("fail to msgrcv");
			exit(1);
		}
		printf("msgtxt.type:%d,msgtxt.msgtype:%d",msgtxt.type,msgtxt.msgtype);
		dev_uart_mask = msgtxt.text;
		printf("uartmask:%d\n",dev_uart_mask);
		write(dev_uart_fd, &dev_uart_mask,1);
	}
}
